# Specify the minimum version of CMake required for this file
cmake_minimum_required(VERSION 3.10)

# Define the project name and language
project(oled_page C)

# Set the output directory for the executable
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

# Include directories
include_directories(
    ${PROJECT_SOURCE_DIR}/src
    ${PROJECT_SOURCE_DIR}/src/Csource
    ${PROJECT_SOURCE_DIR}/src/hardware
    ${PROJECT_SOURCE_DIR}/src/hardware/ssd1306
    ${PROJECT_SOURCE_DIR}/src/utils
    )

# Automatically collect source files from src/
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_FILES)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/Csource OLED_UI)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/hardware HARDWARE)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/hardware/ssd1306 SSD1306)
aux_source_directory(${PROJECT_SOURCE_DIR}/src/utils UTILS)

# Add an executable target using collected source files and main.c
add_executable(oled_page main.c ${SRC_FILES} ${OLED_UI} ${HARDWARE} ${UTILS} ${SSD1306})

# Link libraries if needed
target_link_libraries(oled_page PRIVATE pthread m rt pigpio)  # Add any additional libraries here